import type log4js from 'koa-log4';
import path from 'path';

const log4jConfig: log4js.Configuration = {
    appenders: {
        access: {
            type: 'dateFile',
            pattern: '-yyyy-MM-dd.log',
            filename: path.join(path.dirname(path.dirname(__dirname)), 'logs', 'access.log'),
        },
        application: {
            type: 'dateFile',
            pattern: '-yyyy-MM-dd.log',
            filename: path.join(path.dirname(path.dirname(__dirname)), 'logs', 'application.log'),
        },
        out: {
            type: 'console',
        },
    },
    categories: {
        default: { appenders: ['out'], level: 'info' },
        access: { appenders: ['access'], level: 'info' },
        application: { appenders: ['application'], level: 'warn' },
    },
};

export default log4jConfig;
